package com.yyedu.examol.dao;

import com.yyedu.examol.util.Configuration;
/**
* @ClassName: DAOFactory 
* @Description: DAO工厂
* @author Kenny 27905556@qq.com
* @date 2015年9月29日 下午4:57:19 
*
 */
public class DAOFactory {
	/**
	 * 根据dao接口名，返回相应的实现类
	 * @param daoName
	 * @return
	 */
	public static Object findDAOImpl(final String daoName){
		String daoClass = Configuration.get(daoName.toLowerCase());
		try {
			//System.out.println("daoclass:" + daoClass);
			return Class.forName(daoClass).newInstance();
		} catch (InstantiationException | IllegalAccessException
				| ClassNotFoundException e) {
			e.printStackTrace();
		}
		return null;
	}
}
